package com.prs.crm.dao.taskmanager.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.taskmanager.ReceiveStateDao;
import com.prs.crm.domain.taskmanager.ReceiveState;

public class ReceiveStateDaoImpl extends BaseDaoImpl<ReceiveState> implements ReceiveStateDao{

	@Override
	public ReceiveState getReceiveState(final String code) {
		Criteria criteria=this.getSession().createCriteria(ReceiveState.class);
		criteria.add(Restrictions.eq("type", code));
		List result=criteria.list();
		if(result==null || result.size()==0){
			return null;
		}
		return (ReceiveState) criteria.list().get(0);
	}
}
